{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li {if $_GPC['do'] == 'storemanage' && $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('storemanage', array('op'=>'list'));}">店铺管理</a></li>
		{if !empty($assign)}
		<li {if $op == 'assign_store'}class="active"{/if}><a href="{php echo $this->createWebUrl('storemanage', array('op'=>'assign_store'));}">操作员分配店铺</a></li>
		<li {if $_GPC['do'] == 'admin_logs'}class="active"{/if}><a href="{php echo $this->createWebUrl('admin_logs', array('op'=>'display'));}">操作日志</a></li>
		{/if}
	</ul>
	<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="wn_storex" />
				<input type="hidden" name="do" value="admin_logs" />
				<div class="form-group">
					<div class=" col-xs-12 col-sm-2 col-lg-2">
						<button class="btn btn-default" name="export" value="export"><i class="fa fa-download"></i> 导出数据</button>
					</div>
				</div>
				<div class="form-group">
				</div>
			</form>
		</div>
	</div>

	<div class="panel panel-default">
		<div class="panel-body table-responsive">
		<table class="table table-hover">
			<thead class="navbar-inner">
			<tr><th class='with-checkbox' style='width:30px;'>
				<input type="checkbox" class="check_all" /></th>
				<th style="width:100px;">管理员</th>
				<th style="width:200px;">操作店铺</th>
				<th style="width:200px;">操作时间</th>
				<th style="width:200px;">操作内容</th>
				<th style='width:220px;'>操作URL</th>
				<th style="width:200px;">操作</th>
			</tr>
			</thead>
			<tbody>
			{loop $list $item}
			<tr>
				<td class="with-checkbox">
				<input type="checkbox" name="check" value="{$item['id']}"></td>
				<td>{$item['username']}</td>
				<td>{$item['storeid']}</td>
				<td>{php echo date('Y-m-d H:i:s', $item['time'])}</td>
				<td>{$item['content']}</td>
				<td>{$item['url']}</td>
				<td>
					<a class="btn btn-default" href="#" onclick="drop_confirm('您确定要删除该条操作记录么?', '{php echo $this->createWebUrl('admin_logs',array('op'=>'delete', 'id'=>$item['id']))}');" title="删除" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-times"></i></a>
				</td>
			</tr>
			{/loop}
			<tr>
				<td colspan="8">
					<input type="button" class="btn btn-primary" name="deleteall" value="删除选择的" />
				</td>
			</tr>
			</tbody>
			<input name="token" type="hidden" value="{$_W['token']}" />
		</table>
	</div>
	</div>
	{$pager}
</div>
<script>
	require(['bootstrap'],function($){
		$('.btn').tooltip();
	});
	$(function(){
		$(".check_all").click(function(){
			var checked = $(this).get(0).checked;
			$(':checkbox').each(function(){this.checked = checked});
		});
		$("input[name=deleteall]").click(function(){
			var check = $("input:checked");
			if(check.length<1){
				err('请选择要删除的记录!');
				return false;
			}
			if( confirm("确认要删除选择的记录?")){
				var id = new Array();
				check.each(function(i){
					id[i] = $(this).val();
				});
				$.post("{php echo $this->createWebUrl('admin_logs',array('op'=>'deleteall'))}", {idArr:id},function(data){
					if (data.message.errno ==0) {
						util.message(data.message.message, 'refresh', 'success');
					} else {
						util.message(data.message.message);
					}
				},'json');
			}
		});
	});
	
	function drop_confirm(msg, url){
		if(confirm(msg)){
			window.location = url;
		}
	}
</script>
{template 'common/footer'}